package com.beehoo.dcportal.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.beehoo.dcportal.common.base.BaseDao;
import com.beehoo.dcportal.common.base.BaseException;
import com.beehoo.dcportal.dao.IOrganizationDao;
import com.beehoo.dcportal.model.OrganizationBean;

public class OrganizationDaoImpl extends BaseDao implements IOrganizationDao {
	
	private static final Logger logger = Logger.getLogger(OrganizationDaoImpl.class);


	@SuppressWarnings("unchecked")
	@Override
	public List<OrganizationBean> getOrganizationList(String streetId)
			throws BaseException {
		List<OrganizationBean> orgList = new ArrayList<OrganizationBean>();
		
		try {
			orgList = (List<OrganizationBean>)sqlMapClient.queryForList("portal-org.getOrganizationList", streetId);
			
			logger.info("组织机构列表-获取组织机构列表|#调用portal-org.getOrganizationList " +
					"中心编号："+streetId+",成功!");
		} catch (SQLException e) {
			logger.error("组织机构列表-获取组织机构列表|#调用portal-org.getOrganizationList " +
					"中心编号："+streetId+",失败!", e);
			throw new BaseException(e, "获取组织机构列表失败");
		}
		
		return orgList;
	}

}
